﻿<UserControl 
    x:Class="Modules.TemplateEditor.EditorRegion.TemplateEditorView"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    Width="Auto"
    Height="Auto"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    Visibility="Collapsed">
    <Grid x:Name="LayoutRoot" Background="#FFF0F0F0"
		Height="auto" Width="auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="38"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="148"/>
            <RowDefinition Height="37"/>
        </Grid.RowDefinitions>


        <dataInput:Label Grid.ColumnSpan="2" Grid.Row="0" Height="16" 
			Margin="8,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"
			Content="Name:"/>
        <TextBox x:Name="templateName" Grid.ColumnSpan="2" Grid.Row="0" Height="22" 
			Margin="54,0,8,0" VerticalAlignment="Center" Text="{Binding Name, Mode=TwoWay}"/>

        <Border Margin="8" Grid.Column="0" Grid.Row="1" BorderBrush="Black" BorderThickness="1" CornerRadius="4">
            <TextBox x:Name="description" Margin="8,8,8,8" 
				TextWrapping="Wrap" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible"
				AcceptsReturn="True" Text="{Binding Description, Mode=TwoWay}" 
			/>
        </Border>
        <dataInput:Label Grid.Column="0" Grid.Row="1" Background="#FFF0F0F0"
				Margin="16,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"
				Content=" Description "/>

        <Border Margin="8" Grid.Column="0" Grid.Row="2" BorderBrush="Black" BorderThickness="1" CornerRadius="4">
            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="8,4,8,4">

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="74"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <dataInput:Label Grid.Column="0" Grid.Row="0" 
					VerticalAlignment="Center" 
					Content="Authority:"/>
                <TextBox x:Name="authority" Grid.Column="3" Grid.Row="0" Height="22" 
					VerticalAlignment="Center"
					IsReadOnly="True" Text="{Binding StatusAuthority, Mode=OneWay}"/>

                <dataInput:Label Grid.Column="0" Grid.Row="1"
					VerticalAlignment="Center" 
					Content="Recorded:"/>
                <TextBox x:Name="recorded" Grid.Column="3" Grid.Row="1" Height="22" 
					VerticalAlignment="Center"
					IsReadOnly="True" Text="{Binding StatusClass, Mode=OneWay}"/>

                <dataInput:Label Grid.Column="0" Grid.Row="2"
					VerticalAlignment="Center" 
					Content="Date From:"/>
                <TextBox x:Name="dateFrom" Grid.Column="3" Grid.Row="2" Height="22" 
					VerticalAlignment="Center"
					IsReadOnly="True" Text="{Binding StatusFrom, Mode=OneWay}"/>

                <dataInput:Label Grid.Column="0" Grid.Row="3"
					VerticalAlignment="Center" 
					Content="Date To:"/>
                <TextBox x:Name="dateTo" Grid.Column="3" Grid.Row="3" Height="22" 
					VerticalAlignment="Center"
					IsReadOnly="True" Text="{Binding StatusTo, Mode=OneWay}" />

            </Grid>
        </Border>
        <dataInput:Label Grid.Column="0" Grid.Row="2" Background="#FFF0F0F0"
				Margin="16,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"
				Content=" Status "/>

        <Border Margin="8" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" BorderBrush="Black" BorderThickness="1" CornerRadius="4">
            <Grid Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="200"/>
                </Grid.RowDefinitions>
                
                <ListBox 
                    x:Name="lstRoles1" 
                    Margin="8,8,8,8" 
                    Grid.Row="0"
                    DisplayMemberPath="Key"
                    ItemsSource="{Binding  Roles, Mode=OneWay}"/>
                
                <Grid Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="8,4,8,4">

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="74"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>                        
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>                        
                        <RowDefinition Height="35"/>
                    </Grid.RowDefinitions>
                                        
                    <dataInput:Label 
                        Grid.Column="0" 
                        Grid.Row="0" 
                        VerticalAlignment="Center" 
                        Content="Id:"/>
                    
                    <TextBox 
                        x:Name="roleId" 
                        Grid.Column="1" 
                        Grid.Row="0" 
                        Height="22" 
                        VerticalAlignment="Center"
                        IsReadOnly="True"
                        Text="{Binding SelectedRoleIdentifier, Mode=OneWay}"/>

                    <dataInput:Label 
                        Grid.Column="0" 
                        Grid.Row="1" 
                        VerticalAlignment="Center" 
                        Content="Name:"/>
                    
                    <TextBox 
                        x:Name="roleName" 
                        Grid.Column="1" 
                        Grid.Row="1" 
                        Height="22" 
				        VerticalAlignment="Center"					    
                        IsReadOnly="{Binding IsReadOnly, Mode=OneWay}"
                        Text="{Binding SelectedRoleName, Mode=OneWay}"/>

                    <dataInput:Label 
                        Grid.Column="0" 
                        Grid.Row="2" 
                        VerticalAlignment="Center" 
                        Content="Description:"/>
                    
                    <TextBox 
                        x:Name="roleDescription" 
                        Grid.Column="1" 
                        Grid.Row="2" 
                        Height="22" 
				        VerticalAlignment="Center"					    
                        IsReadOnly="{Binding IsReadOnly, Mode=OneWay}"
                        Text="{Binding SelectedRoleDescription, Mode=OneWay}"/>

                    <dataInput:Label 
                        Grid.Column="0" 
                        Grid.Row="3" 
                        VerticalAlignment="Center" 
                        Content="Range:" />

                    <ComboBox
                        x:Name="roleRange" 
                        Grid.Column="1"
                        Grid.Row="3" 
                        Height="22" 
				        VerticalAlignment="Center"                        
                        IsEnabled="{Binding IsEnabled, Mode=OneWay}"
                        ItemsSource="{Binding Ranges, Mode=TwoWay}"
                        DisplayMemberPath="Value"
                        SelectedItem="{Binding SelectedRoleRange, Mode=TwoWay}"/>
                    
                    <Button 
                        x:Name="addRole1" 
				        Grid.ColumnSpan="2"
                        Grid.Row="4" 
                        Height="21" 
                        Width="60" 
				        Margin="8,0,0,8" 
                        HorizontalAlignment="Left" 
                        VerticalAlignment="Bottom" 
                        IsEnabled="{Binding IsEnabled, Mode=OneWay}"
				        Content="Add" />
                    
                    <Button 
                        x:Name="removeRole1" 
                        Grid.ColumnSpan="2"
				        Grid.Row="4" 
                        Height="21" 
                        Width="60" 
				        Margin="76,0,0,8" 
                        HorizontalAlignment="Left" 
                        VerticalAlignment="Bottom"
                        IsEnabled="{Binding IsEnabled, Mode=OneWay}"
				        Content="Remove" />
                    
                    <Button 
                        x:Name="applyRole1" 
				        Grid.ColumnSpan="2"
                        Grid.Row="4" 
                        Height="21" 
                        Width="60" 
				        Margin="144,0,0,8" 
                        HorizontalAlignment="Left" 
                        VerticalAlignment="Bottom" 
                        IsEnabled="{Binding IsEnabled, Mode=OneWay}"
				        Content="Apply" />

                </Grid>
            
        </Grid>

        </Border>

        <dataInput:Label x:Name="heading" Grid.Column="1" Grid.Row="1" Background="#FFF0F0F0"
				Margin="16,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"
				Content="{Binding Heading, Mode=OneWay}"/>

        <Button x:Name="btnApply1" 
			Grid.Column="1" Grid.Row="3" Height="21" Width="73"
			Margin="0,0,8,0" VerticalAlignment="Center" HorizontalAlignment="Right"  
			Content="Apply" Tag="Apply1"/>
        <Button x:Name="btnCancel1" 
			Grid.Column="1" Grid.Row="3" Height="21" Width="73" 
			Margin="0,0,89,0" VerticalAlignment="Center" HorizontalAlignment="Right" 
			Content="Cancel" Tag="Cancel1"/>
        <Button x:Name="btnOK1"
			Grid.Column="1" Grid.Row="3" Height="21" Width="73"
			Margin="0,0,170,0" VerticalAlignment="Center" HorizontalAlignment="Right" 
			Content="OK" Tag="OK1"/>

    </Grid>
</UserControl>

<!--
id
name
description
status
role definition
-->